<%- include('./layouts/admin_header.ejs'); %>
<%- include('./layouts/admin_navbar.ejs'); %>
<div class="container-fluid">
  <div class="page-title">
    <h1>分类目录</h1>
  </div>
  <!-- 有错误信息时展示 -->
  <div class="alert alert-danger" style="display: none">
    <strong>提示！</strong><span>发生XXX错误</span>
  </div>
  <div class="row">
    <div class="col-md-4">
      <form>
        <input type="hidden" name="id" value="" id="id">
        <h2 class="optinfo">添加新分类目录</h2>
        <div class="form-group">
          <label for="name">名称</label>
          <input id="name" class="form-control" name="name" type="text" placeholder="分类名称" value="是稍等">
        </div>
        <div class="form-group">
          <label for="slug">别名</label>
          <input id="slug" class="form-control" name="slug" type="text" placeholder="slug" value="我是">
          <p class="help-block">https://zce.me/category/<strong>slug</strong></p>
        </div>
        <div class="form-group">
          <input class="btn btn-primary btnAdd" type="button" value="添加">
          <input class="btn btn-primary btnEdit" type="button" value="编辑" style="display: none">
        </div>
      </form>
    </div>
    <div class="col-md-8">
      <div class="page-action">
        <!-- show when multiple checked -->
        <a class="btn btn-danger btn-sm btndels" href="javascript:;" style="display: none">批量删除</a>
      </div>
      <table class="table table-striped table-bordered table-hover">
        <thead>
          <tr>
            <th class="text-center" width="40"><input type="checkbox" class="chkAll"></th>
            <th>名称</th>
            <th>Slug</th>
            <th class="text-center" width="100">操作</th>
          </tr>
        </thead>
        <tbody>

          <!-- <tr>
            <td class="text-center"><input type="checkbox"></td>
            <td>未分类</td>
            <td>uncategorized</td>
            <td class="text-center">
              <a href="javascript:;" class="btn btn-info btn-xs">编辑</a>
              <a href="javascript:;" class="btn btn-danger btn-xs">删除</a>
            </td>
          </tr> -->
        </tbody>
      </table>
    </div>
  </div>
</div>
</div>
<%- include('./layouts/admin_aside.ejs'); %>
<%- include('./layouts/admin_footer.ejs'); %>

<script type="text/template" id="cateListTemp">
  {{each data val index}}
  <tr>
    <td class="text-center"><input type="checkbox" class="chkSingle" data-id="{{val.id}}"></td>
    <td>{{val.name}}</td>
    <td>{{val.slug}}</td>
    <td class="text-center">
      <a href="javascript:;" class="btn btn-info btn-xs btnedit" data-id='{{val.id}}' data-name='{{val.name}}' data-slug='{{val.slug}}'>编辑</a>
      <a href="javascript:;" data-id='{{val.id}}' class="btn btn-danger btn-xs Delbtn">删除</a>
    </td>
  </tr>
  {{/each}}
</script>

<script src="/assets/vendors/template/template.js"></script>
<script src="/assets/js/categories.js"></script>
